package model02;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

  public class scjp{
  JTextField txtField;
  JLabel lbl;
  public static void main(String[] args)
  {
  scjp sdd = new scjp();
  }

  public scjp(){
  JFrame frame = new JFrame("Nguyen Thanh Huy");
  txtField = new JTextField(20);
  JRadioButton lbl=new JRadioButton("Hello");
  lbl.setTransferHandler(new TransferHandler("text"));

  JRadioButton lbl1=new JRadioButton("Hello1");
  lbl.setTransferHandler(new TransferHandler("text"));



  MouseListener ml = new MouseAdapter(){
  public void mousePressed(MouseEvent e){
  JComponent jc = (JComponent)e.getSource();
  TransferHandler th = jc.getTransferHandler();
  th.exportAsDrag(jc, e, TransferHandler.COPY);
  }
  };

  lbl.addMouseListener(ml);
  JPanel panel = new JPanel();
  panel.add(txtField);
  frame.add(lbl, BorderLayout.CENTER);
  frame.add(panel, BorderLayout.NORTH);
  frame.setSize(400, 400);
  frame.setVisible(true);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setResizable(false);
  }
}
